package com.example.controller;

import com.example.common.Result;
import com.example.entity.DailyRecords;
import com.example.service.DailyRecordService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/dailyRecord")
public class DailyRecordController {
    @Resource
    private DailyRecordService dailyRecordService;

    @PostMapping("/add")
    public Result addDailyRecord(@RequestBody DailyRecords dailyRecords){
        return dailyRecordService.addDailyRecord(dailyRecords);
    }

    @PostMapping("/update")
    public Result updateDailyRecord(@RequestBody DailyRecords dailyRecords){
        return dailyRecordService.updateDailyRecord(dailyRecords);
    }

    @PostMapping("/list")
    public Result list(@RequestBody DailyRecords dailyRecords){
        return dailyRecordService.list(dailyRecords);
    }

    @PostMapping("/listAll")
    public Result listAll(@RequestBody DailyRecords dailyRecords){
        return dailyRecordService.listAll(dailyRecords);
    }
}
